package com.tms.app.tms.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tms.app.tms.R;
import com.tms.app.tms.bean.TestBean;
import com.tms.app.tms.bean.response.WaybillListRes;

import java.util.List;

/**
 * Created by happy on 2017/8/26.
 */

public class WayBillAdapter extends BaseQuickAdapter<WaybillListRes.DataBean, BaseViewHolder> {
    public WayBillAdapter() {
        super(R.layout.item_home_waybill);
    }



    @Override
    protected void convert(BaseViewHolder helper, WaybillListRes.DataBean item) {

        helper.setText(R.id.item_textView,"运单号 ： "+item.getWaybillNo());
        int [] ids ={R.id.item_text_status1,R.id.item_text_status2,R.id.item_text_status3};
        for (int i = 0; i < item.getDoTypeList().size(); i++) {
            helper.setText(ids[i],item.getDoTypeList().get(i).getDoTypeName());
        }
        setBusiType(helper,item.getBusiType()+"");

    }

    private void setBusiType(BaseViewHolder helper,String ... type){
        TextView textView1=helper.getView(R.id.text_fabu_type1);
        TextView textView2=helper.getView(R.id.text_fabu_type2);
        TextView textView3=helper.getView(R.id.text_fabu_type3);

        textView1.setVisibility(View.GONE);
        textView2.setVisibility(View.GONE);
        textView3.setVisibility(View.GONE);

        for (String s : type) {
            switch (s){
                case "0":
                    textView1.setVisibility(View.VISIBLE);
                    break;
                case "1":
                    textView2.setVisibility(View.VISIBLE);
                    break;
                case "2":
                    textView3.setVisibility(View.VISIBLE);
                    break;
            }
        }

    }
}
